/*
 * Copyright (c) 2023-2024 elsfs Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.elsfs.cloud.module.dict.api.repository;

import org.elsfs.cloud.common.mybatis.repository.IElsfsRepository;
import org.elsfs.cloud.module.dict.api.entity.GenDatasourceConf;

/**
 * 数据源表
 *
 * @author zeng
 */
public interface GenDatasourceConfRepository extends IElsfsRepository<GenDatasourceConf, String> {

  /**
   * 保存数据源并且加密
   *
   * @param genDatasourceConf genDatasourceConf
   * @return boolean
   */
  Boolean saveDsByEnc(GenDatasourceConf genDatasourceConf);

  /**
   * 更新数据源
   *
   * @param genDatasourceConf genDatasourceConf
   * @return bool
   */
  Boolean updateDsByEnc(GenDatasourceConf genDatasourceConf);

  /**
   * 更新动态数据的数据源列表
   *
   * @param datasourceConf datasourceConf
   */
  void addDynamicDataSource(GenDatasourceConf datasourceConf);

  /**
   * 校验数据源配置是否有效
   *
   * @param datasourceConf 数据源信息
   * @return 有效/无效
   */
  Boolean checkDataSource(GenDatasourceConf datasourceConf);

  /**
   * 通过数据源名称删除
   *
   * @param dsIds 数据源ID
   * @return boolean
   */
  Boolean removeByDsId(Long[] dsIds);
}
